# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=qbs

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2.1
pkgrel=1
_pkgfqn="${_realname}-${pkgver}.src"
pkgdesc='Qt Build Suite'
url='http://qt-project.org'
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-qt5")
options=('docs' 'strip' 'staticlibs')
source=("http://download.qt-project.org/official_releases/qbs/${pkgver}/${_pkgfqn}.tar.gz"
        fix-installing-headers.patch
        manifest)
sha256sums=('3fb0a7203328e153285f9b134da1e73f9ce8017337efd11ede5598e4b82800b4'
            'c340c3cf38794da9cca17fd4cb9b43eb0bd5858372b43704873f234a9a014acb'
            '838098b25a8044176b3139b4003594570c62a8d64f5470fbbd769f3bf44e0855')

prepare() {
  cd ${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/fix-installing-headers.patch
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  ${MINGW_PREFIX}/bin/qmake.exe qbs.pro CONFIG+=release
  make
  make docs
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}
  make INSTALL_ROOT=${pkgdir}${MINGW_PREFIX} install
  make INSTALL_ROOT=${pkgdir}${MINGW_PREFIX} install_docs
  
  rm -f ${pkgdir}${MINGW_PREFIX}/lib/*.dll
  
  for file in qbs-setup-madde-platforms qbs-setup-qt; do
    cp ${srcdir}/manifest ${pkgdir}${MINGW_PREFIX}/bin/${file}.exe.manifest
  done
}

